﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace WCS.Infrastructure.EFCore;

/// <summary>
/// 抽奖奖品表
/// </summary>
[Table("LotteryPrize")]
[Index("ActivityId", "Enabled", Name = "idx_LotteryPrize_Activity")]
public partial class LotteryPrize
{
    /// <summary>
    /// 奖品ID
    /// </summary>
    [Key]
    [StringLength(32)]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 所属活动ID
    /// </summary>
    [StringLength(32)]
    public string ActivityId { get; set; } = null!;

    /// <summary>
    /// 奖品编号
    /// </summary>
    [StringLength(32)]
    public string? PrizeCode { get; set; }

    /// <summary>
    /// 奖品名称
    /// </summary>
    [StringLength(64)]
    public string? Name { get; set; }

    /// <summary>
    /// 奖品自身抽中概率（比例值），有效奖品概率和≤1，其余视为“谢谢参与”
    /// </summary>
    [Precision(9, 6)]
    public decimal Ratio { get; set; }

    /// <summary>
    /// 奖品库存（中奖后扣减）
    /// </summary>
    public int? Stock { get; set; }

    /// <summary>
    /// 启用状态（true=启用，false=禁用）
    /// </summary>
    public bool? Enabled { get; set; }

    /// <summary>
    /// 关联优惠券模板ID（中奖后发券使用）
    /// </summary>
    [StringLength(32)]
    public string? TemplateId { get; set; }

    /// <summary>
    /// 排序（用于展示/配置）
    /// </summary>
    public int? Sort { get; set; }

    /// <summary>
    /// 扩展属性（JSON文本）
    /// </summary>
    public string? ExtraProperties { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime CreationTime { get; set; }
}
